home *** CD-ROM | disk | FTP | other *** search
- Path: anvil.ugrad.cs.ubc.ca!not-for-mail
- From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
- Newsgroups: comp.lang.ada,comp.lang.c,comp.lang.c++
- Subject: Re: C/C++ knocks the crap out of Ada
- Date: 29 Feb 1996 15:10:53 -0800
- Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
- Message-ID: <4h5bptINN9oi@anvil.ugrad.cs.ubc.ca>
- References: <JSA.96Feb16135027@organon.com> <1996Feb22.005518.13396@leeweyr.sccsi.com> <4gvrffINNlqo@anvil.ugrad.cs.ubc.ca> <SPENCER.96Feb29102241@zorgon.ERA.COM>
- NNTP-Posting-Host: anvil.ugrad.cs.ubc.ca
-
- In article <SPENCER.96Feb29102241@zorgon.ERA.COM>,
- Spencer Allain <spencer@ERA.COM> wrote:
- >In article <4gvrffINNlqo@anvil.ugrad.cs.ubc.ca> c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku) writes:
- >
- > What is intrinsically unsafe about C? I could write a strict,
- > standard-conforming, anally-retentive program in any language that could kill
- > people (maliciously, of course).
- >
- > Software which has life-threatening consequences shoud not be left to something
- > that sacrifices intimacy with hardware for some higher purpose that has more to
- > do with bureaucracy than anything else.
- >
- > And it should certainly not be written in some poorly standardized language,
- > for which no two implementations are in agreement. C is governed by an
- > ISO standard, which, if adhered to, lets a strictly conforming program
- > translated by a strictly conforming implementation yield well-defined results.
- >
- > I don't think you can say the same for Ada or C++.
- > --
- >
- >Whoa there. I think somebody has been feed a lot of misinformation.
- >
- >Yes, C has an ISO standard, but this is only one aspect of the safety
- >issue.
- >
- >What is intrinsically unsafe about C? I'm not about to rehash what's
- >been said a million times, but any programming language that allows
- >you to walk all over memory without any checks is considered
- >intrinsically unsafe.
-
- This is not necessarily true of an implementation. Accessing memory outside of
- a static, automatic or malloc-ed object is undefined behavior under the
- standard. It is not condoned. Nowhere does the standard encourage
- implementations to _not_ implement run-time and static checks for such
- violations.
-
- Many compilers can perform pointer dereference checks through inline code.
- There are ways to debug use of heap storage.
-
- You are confusing the language specification with the implementation. The C
- specification does not call for the ability randomly access memory. The only
- way to legally manufacture pointers is by taking the addresses of named
- objects, using the standard defined function malloc() or through pointer
- arithmetic (adding an integral displacement to an existing pointer---an
- operation which yields undefined results if you try to create a pointer outside
- of an object). You aren't even legally allowed to subtract two pointers that
- don't reference the same object, even if they have compatible types.
-
- >And who told you that Ada hasn't been standardized?
-
- Oops. I should not have included Ada in that, just C++. My apologies. Of course
- Ada is standardized!
-
- If C is ``unsafe'', C++ is lethal.
-
- Whether C is more or less unsafe than Ada is truly debatable. A
- standard-conforming, _quality_ implementation of either language coupled with
- adherent programs subject to rigorous quality control is suitable for
- safety-critical software.
- --
-
-